package com.qls.web.modules.ht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qls.core.entity.HtRoomType;
import com.qls.web.common.utils.PageUtils;
import com.qls.web.common.utils.Query;
import com.qls.web.modules.ht.dao.HtPhysicalRoomDao;
import com.qls.web.modules.ht.service.HtPhysicalRoomService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("htPhysicalRoomService")
public class HtPhysicalRoomServiceImpl extends ServiceImpl<HtPhysicalRoomDao, HtRoomType> implements HtPhysicalRoomService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Object hotelCode = params.get("hotelCode");
        Object roomName = params.get("roomName");
        IPage<HtRoomType> page = this.page(
                new Query<HtRoomType>().getPage(params),
                new QueryWrapper<HtRoomType>().eq(hotelCode != null && hotelCode != "", "hotel_code", hotelCode).like(roomName != null && roomName != "", "room_name", roomName)
        );
        return new PageUtils(page);
    }

}